package com.app.core.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by KUMA on 2017/1/19.
 */
public class TimeUtils {
    public static String formatAll(Long date) {
        if (date == null) {
            return "未知时间";
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        return sdf.format(new Date(date));
    }

    public static String formatTime(Long date) {
        if (date == null) {
            return "未知时间";
        }
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        return sdf.format(new Date(date));
    }

    public static String formatOrder(Long date) {
        if (date == null) {
            return "未知时间";
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(new Date(date));
    }

    public static String formatMonth(Long date) {
        if (date == null) {
            return "未知时间";
        }
        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
        return sdf.format(new Date(date));
    }

    public static String formatTruck(Long date) {
        if (date == null) {
            return "未知时间";
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        return sdf.format(new Date(date));
    }
}
